import { registerAs } from '@nestjs/config';

/**
 * 微信小程序配置
 */
export interface WeChatMiniProgramConfigInterface {
  url: string;
  appid: string;
  secret: string;
  grant_type: string;
}

const weChatMiniProgramConfig: WeChatMiniProgramConfigInterface = {
  url: 'https://api.weixin.qq.com/sns/jscode2session',
  appid: process.env.wechat_appid,
  secret: process.env.wechat_secret,
  grant_type: 'authorization_code',
};

export const WeChatMiniProgramsConfig = registerAs(
  'weChatMiniProgram',
  () => weChatMiniProgramConfig,
);
